<template>
  <div class="main">
    <el-button v-on:click="show=!show" type="success" size="small">点击</el-button>
    <transition name="fade" > <!-- name 属性必备 -->
       <div class="box" v-if="show"></div>
    </transition> 
    <!-- 单词千万别写错！！！ -->
  </div>
</template>

<script>
export default {
 name:'Transtion',
 data(){
   return{
     show:false
   }
 },
 methods(){

 }
}
</script>

<style scoped>
.main {
  margin: 100px;
}
.box {
  height: 500px;
  width: 500px;
  margin: 100px;
  background-color: rebeccapurple;
}
/* .fade-enter-active,
.fade-leave-active {
  transition: opacity 1s;
}
.fade-enter,
.fade-leave-to {
  opacity: 0s;
} */

.fade-leave-active {
  transition: all 0.38s linear;
  height: 400px;
  opacity: 0;
}
.fade-enter {
  opacity: 1;
  transform: translateX(-110px);
}
/* .fade-enter-active {
  opacity: 1;
} */
</style>
